<?php

if (!defined('access')){
	die ('Direct access Denied!');
} else {

	$news = new News();
	$news = $news->getNews($_GET['from'],$_GET['to']);
	// DEV
	setlocale(LC_ALL, 'fra');
	foreach ($news as $billet){
		$day = strftime('%d', strtotime($billet['newsdate']));
		$month = strftime('%B', strtotime($billet['newsdate']));
?>

	<div class="billet">
		<div class="header"><?php echo $billet['username']; ?>
			<div class="date">
				<div class="day"><?php echo $day; ?></div>
				<div class="month"><?php echo $month; ?></div>
			</div>
			<div class="title"><?php echo $billet['newstitle']; ?></div>
		</div>
		<div class="content"><?php echo substr($billet['newstext'],0,800); ?></div>
		<div class="footer">
			<div class="comment"><a href="index.php?page=comment&id=<?php echo $billet['newsid']; ?>">XX Commentaires</a></div>
			<div class="readmore"><a href="index.php?page=news&id=<?php echo $billet['newsid']; ?>">Lire la suite</a></div>
		</div>
	</div>

<?php } 

$page = new Pagination($newsperpage,'news');
echo $page->getPage();

} ?>